﻿@model ForumLastActiveDiscussionsModel
@using Nop.Plugin.Widgets.ForumLast.Models;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Web.Framework.UI;
@using Nop.Web.Extensions;

@{
    Html.AddScriptParts("~/Plugins/Widgets.ForumLast/Content/jquery.easy-ticker.js");
    var supportRtl = EngineContext.Current.Resolve<IWorkContext>().WorkingLanguage.Rtl;
    Html.AddCssFileParts("~/Plugins/Widgets.Forumlast/Content/forum-last.css");
    if (supportRtl)
    {
        Html.AddCssFileParts("~/Plugins/Widgets.Forumlast/Content/forum-last.rtl.css");
    }
}

<script>
    $(function () {
        $('#forum-last').easyTicker({
            direction: '@Model.Direction',
            visible: @Model.Visible,
            interval: @Model.Interval,
            controls: {
                up: '#forum-last-btnUp',
                down: '#forum-last-btnDown',
                //toggle: '#forum-last-btnToggle',
            }
        });
    });
</script>


@if (Model.ForumTopics.Count > 0)
{
    <div class="panel panel-default form-panel hidden-xs hidden-sm">
        <div class="panel-heading">
            <h3><a href="@Url.RouteUrl("Boards")">@T("Forum.ActiveDiscussions")</a></h3>
        </div>
        <div class="panel-body">
            <div id="forum-last" class="forum-last">
                <ul>
                    @foreach (var topic in Model.ForumTopics)
                    {
                        <li>
                            <div class="itme-title">
                                <div class="topic-title">
                                    @Html.RouteLink(topic.Subject, "TopicSlug", new { id = topic.Id, slug = topic.SeName }, new { @class = "topic-title" })
                                </div>
                                <div class="text-right topic-com">
                                    @if (topic.CustomerId > 0)
                                    {
                                        <label>@T("Forum.Author"):</label>
                                        if (topic.AllowViewingProfiles)
                                        {
                                            @Html.RouteLink(topic.CustomerName, "CustomerProfile", new { Id = topic.CustomerId })
                                        }
                                        else
                                        {
                                            @topic.CustomerName
                                        }
                                    }
                                </div>
                            </div>
                        </li>
                    }
                </ul>
            </div>
            @if (Model.ShowNavigation)
            {
                <div class="row">
                    <div class="col-md-12 text-center" style="padding-top:10px;">
                        <span id="forum-last-btnUp" class="glyphicon glyphicon-chevron-up"></span>
                        <span id="forum-last-btnDown" class="glyphicon glyphicon-chevron-down"></span>
                    </div>
                </div>
            }
        </div>
    </div>
}


